package pack9999;

import java.util.Scanner;

public class Work02 {
    public static void a(){
        int a, b, c, d;
        System.out.println("请输入一个任意三个整数进行大小比较，由小到大排序");
        Scanner input = new Scanner(System.in);
        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();
        System.out.println("排序前");
        System.out.println("a =" + a);
        System.out.println("b =" + b);
        System.out.println("c = " + c);
        if (a > b) {
            d = a;
            a = b;
            b = d;
        }
        if (a > c) {
            d = a;
            a = c;
            c = d;
        }
        if (b > c) {
            d = b;
            b = c;
            c = d;
        }
        System.out.println("排序后");
        System.out.println("a =" + a);
        System.out.println("b =" + b);
        System.out.println("c = " + c);
    }

    public static void b(){
        int a,b;
        a=5;
        b=6;
        System.out.println("---交换前---");
        System.out.println("a="+a);
        System.out.println("b="+b);
        a=a+b;
        b=a-b;
        a=a-b;
        System.out.println("---交换后---");
        System.out.println("a="+a);
        System.out.println("b="+b);
    }

    public static void c(){
        int x,y,z;
        System.out.println("请输入任意3个整数，由小到大输出！");
        Scanner scanner=new Scanner(System.in);
        x=scanner.nextInt();
        y=scanner.nextInt();
        z=scanner.nextInt();
        System.out.println("---排序前---");
        System.out.println("x="+x);
        System.out.println("y="+y);
        System.out.println("z="+z);
        System.out.println("---排序后---");
        if (x<y&&z<y){
            System.out.println("x="+x);
            System.out.println("y="+y);
            System.out.println("z="+z);
        }
        if (x<z&&z<y){
            System.out.println("x="+x);
            System.out.println("z="+z);
            System.out.println("y="+y);
        }
        if (y<x&&x<z){
            System.out.println("y="+y);
            System.out.println("x="+x);
            System.out.println("z="+z);
        }
        if (y<z&&z<x){
            System.out.println("y="+y);
            System.out.println("z="+z);
            System.out.println("x="+x);
        }
        if (z<y&&y<x){
            System.out.println("z="+z);
            System.out.println("y="+y);
            System.out.println("x="+x);
        }
        if (z<x&&x<y){
            System.out.println("z="+z);
            System.out.println("x="+x);
            System.out.println("y="+y);
        }

    }

    public static void d(){
        int a,res;
        Scanner scanner=new Scanner(System.in);
        a= scanner.nextInt();
        res=a%10+a/10%10+a/100%10+a/1000;
        System.out.printf("res="+res);
    }
    public static void main(String[] args) {
        d();
    }
}
